package com.pl.service.impl;  

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pl.bean.ManageBaseMetaBean;
import com.pl.dao.ManageBaseMetaBeanDao;
import com.pl.service.ManageBaseMetaService;

import javax.annotation.Resource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 
 */
@Service("manageBaseMetaService")
public class ManageBaseMetaServiceImpl implements ManageBaseMetaService{

	private static Logger log = LogManager.getLogger();

	@Resource(name="manageBaseMetaBeanDao")
	private ManageBaseMetaBeanDao manageBaseMetaBeanDao;

	/**
	 * 新增
	 */
	@Transactional
	public void addManageBaseMeta(ManageBaseMetaBean manageBaseMetaBean){
		
		manageBaseMetaBeanDao.addManageBaseMetaBean(manageBaseMetaBean);
	}

	/**
	 * 修改
	 */
	@Transactional
	public void updateManageBaseMeta(ManageBaseMetaBean manageBaseMetaBean){
		
		manageBaseMetaBeanDao.updateManageBaseMetaBean(manageBaseMetaBean);
	}
	
	/**
	 * 根据条件获得数量
	 */
	public int getManageBaseMetaNum(ManageBaseMetaBean manageBaseMetaBean){
		
		return manageBaseMetaBeanDao.getManageBaseMetaBeanNum(manageBaseMetaBean);
	}
	
	/**
	 * 根据条件获得数据
	 */
	public List<ManageBaseMetaBean> getManageBaseMeta(ManageBaseMetaBean manageBaseMetaBean){
		
		return manageBaseMetaBeanDao.getManageBaseMetaBean(manageBaseMetaBean);
	}
	
	/**
	 * 根据条件获得数据
	 */
	public List<ManageBaseMetaBean> getManageBaseMetaByKey(String key){
		return manageBaseMetaBeanDao.getManageBaseMetaByKey(key);
	}
	
	/**
	 * 根据条件获得数据
	 */
	public ManageBaseMetaBean getManageBaseMetaById(Long id){
		
		ManageBaseMetaBean manageBaseMetaBean = new ManageBaseMetaBean();
		manageBaseMetaBean.setId(id);
		
		List<ManageBaseMetaBean> list = getManageBaseMeta(manageBaseMetaBean);
		if(list !=null && !list.isEmpty()){
    		return list.get(0);
    	}
    	
    	return null;
	}
}
